import axios from '@/api/config'
import {baseURL} from "@/api/ipconfig"

var ip = baseURL.URL1
//申请管理接口 开始=======

//获取申请列表
export const list = data => axios.post(ip+'/register/page', data)

//新增申请
export const add = data => axios.post(ip+'/register', data)

//修改申请
export const update = data => axios.put(ip+'/register', data)

//获取页面信息
export async function detail(data) {
  const url = ip+'/register/' + data;
  let res = await axios.get(url);
  return res;
}

//获取独立机构列表
export async function getUnitList(data) {
  let url =ip+'/unit/list/';
  if (data) {
    url = url + '?searchWord=' + data
  }
  let res = await axios.get(url);
  return res;
}

//通过id查独立机构信息
export async function getUnitNameByrootId(data) {
  const url =ip+'/unit/' + data;
  let res = await axios.get(url);
  return res;
}

//删除
export async function remove(data) { 
  const url =ip+'/register/logic';
  let res = await axios.delete(url, {
    data
  });
  return res;
}

//审核
export async function audit(data) {
  const url =ip+'/register/examine/' + data.id+'?isPass='+data.isPass+'&sendSms='+data.sendSms;
  let res = await axios.put(url);
  return res;
}
